home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11194 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 63 2b | 2b 2c 63 6f 6d 70 2e 6f |.lang.c+|+,comp.o|
|00000020| 73 2e 6c 69 6e 75 78 2e | 64 65 76 65 6c 6f 70 6d |s.linux.|developm|
|00000030| 65 6e 74 2e 61 70 70 73 | 2c 63 6f 6d 70 2e 6f 73 |ent.apps|,comp.os|
|00000040| 2e 6c 69 6e 75 78 2e 6d | 69 73 63 0a 50 61 74 68 |.linux.m|isc.Path|
|00000050| 3a 20 69 6e 64 72 61 2e | 63 6f 6d 21 75 73 65 6e |: indra.|com!usen|
|00000060| 65 74 0a 46 72 6f 6d 3a | 20 42 65 61 72 20 47 69 |et.From:| Bear Gi|
|00000070| 6c 65 73 20 3c 62 65 61 | 72 40 69 6e 64 72 61 2e |les <bea|r@indra.|
|00000080| 63 6f 6d 3e 0a 53 75 62 | 6a 65 63 74 3a 20 52 65 |com>.Sub|ject: Re|
|00000090| 3a 20 41 72 65 20 73 74 | 72 2a 20 66 75 6e 63 74 |: Are st|r* funct|
|000000a0| 69 6f 6e 73 20 6f 6b 61 | 79 20 69 6e 20 43 2b 2b |ions oka|y in C++|
|000000b0| 3f 0a 4d 65 73 73 61 67 | 65 2d 49 44 3a 20 3c 33 |?.Messag|e-ID: <3|
|000000c0| 31 34 36 41 36 42 36 2e | 36 34 35 35 44 32 35 33 |146A6B6.|6455D253|
|000000d0| 40 69 6e 64 72 61 2e 63 | 6f 6d 3e 0a 53 65 6e 64 |@indra.c|om>.Send|
|000000e0| 65 72 3a 20 75 73 65 6e | 65 74 40 69 6e 64 72 61 |er: usen|et@indra|
|000000f0| 2e 63 6f 6d 20 28 4a 6f | 65 20 49 6c 61 63 71 75 |.com (Jo|e Ilacqu|
|00000100| 61 29 0a 4d 69 6d 65 2d | 56 65 72 73 69 6f 6e 3a |a).Mime-|Version:|
|00000110| 20 31 2e 30 0a 58 2d 4d | 61 69 6c 65 72 3a 20 4d | 1.0.X-M|ailer: M|
|00000120| 6f 7a 69 6c 6c 61 20 32 | 2e 30 20 28 58 31 31 3b |ozilla 2|.0 (X11;|
|00000130| 20 49 3b 20 4c 69 6e 75 | 78 20 31 2e 33 2e 36 39 | I; Linu|x 1.3.69|
|00000140| 20 69 34 38 36 29 0a 43 | 6f 6e 74 65 6e 74 2d 54 | i486).C|ontent-T|
|00000150| 79 70 65 3a 20 74 65 78 | 74 2f 70 6c 61 69 6e 3b |ype: tex|t/plain;|
|00000160| 20 63 68 61 72 73 65 74 | 3d 75 73 2d 61 73 63 69 | charset|=us-asci|
|00000170| 69 0a 4f 72 67 61 6e 69 | 7a 61 74 69 6f 6e 3a 20 |i.Organi|zation: |
|00000180| 41 63 6d 65 20 55 6e 69 | 76 65 72 73 69 74 79 2c |Acme Uni|versity,|
|00000190| 20 57 2e 20 45 2e 20 43 | 6f 79 6f 74 65 2c 20 70 | W. E. C|oyote, p|
|000001a0| 72 65 73 69 64 65 6e 74 | 0a 44 61 74 65 3a 20 57 |resident|.Date: W|
|000001b0| 65 64 2c 20 31 33 20 4d | 61 72 20 31 39 39 36 20 |ed, 13 M|ar 1996 |
|000001c0| 31 30 3a 34 33 3a 30 32 | 20 47 4d 54 0a 52 65 66 |10:43:02| GMT.Ref|
|000001d0| 65 72 65 6e 63 65 73 3a | 20 3c 34 68 70 76 69 30 |erences:| <4hpvi0|
|000001e0| 24 67 74 36 40 6e 65 77 | 73 2e 70 6c 61 74 69 6e |$gt6@new|s.platin|
|000001f0| 75 6d 2e 63 6f 6d 3e 20 | 3c 44 6f 35 34 47 39 2e |um.com> |<Do54G9.|
|00000200| 34 4c 79 2e 30 2e 73 65 | 72 76 65 72 40 69 6e 64 |4Ly.0.se|rver@ind|
|00000210| 72 61 2e 63 6f 6d 3e 20 | 3c 44 6f 36 31 77 4b 2e |ra.com> |<Do61wK.|
|00000220| 49 45 47 40 62 65 61 76 | 65 72 2e 63 73 2e 77 61 |IEG@beav|er.cs.wa|
|00000230| 73 68 69 6e 67 74 6f 6e | 2e 65 64 75 3e 0a 54 6f |shington|.edu>.To|
|00000240| 3a 20 52 61 6e 64 79 20 | 43 68 61 70 6d 61 6e 20 |: Randy |Chapman |
|00000250| 3c 63 68 61 70 6d 61 6e | 40 67 72 69 7a 7a 6c 79 |<chapman|@grizzly|
|00000260| 2e 63 73 2e 77 61 73 68 | 69 6e 67 74 6f 6e 2e 65 |.cs.wash|ington.e|
|00000270| 64 75 3e 0a 58 2d 4e 6e | 74 70 2d 50 6f 73 74 69 |du>.X-Nn|tp-Posti|
|00000280| 6e 67 2d 48 6f 73 74 3a | 20 6e 65 74 2e 69 6e 64 |ng-Host:| net.ind|
|00000290| 72 61 2e 63 6f 6d 0a 43 | 6f 6e 74 65 6e 74 2d 54 |ra.com.C|ontent-T|
|000002a0| 72 61 6e 73 66 65 72 2d | 45 6e 63 6f 64 69 6e 67 |ransfer-|Encoding|
|000002b0| 3a 20 37 62 69 74 0a 0a | 52 61 6e 64 79 20 43 68 |: 7bit..|Randy Ch|
|000002c0| 61 70 6d 61 6e 20 77 72 | 6f 74 65 3a 0a 3e 20 42 |apman wr|ote:.> B|
|000002d0| 65 61 72 20 47 69 6c 65 | 73 20 28 62 65 61 72 40 |ear Gile|s (bear@|
|000002e0| 29 20 77 72 6f 74 65 3a | 0a 3e 20 3a 20 41 6c 73 |) wrote:|.> : Als|
|000002f0| 6f 2c 20 61 6e 6f 74 68 | 65 72 20 75 73 65 66 75 |o, anoth|er usefu|
|00000300| 6c 20 74 65 63 68 6e 69 | 71 75 65 20 66 6f 72 20 |l techni|que for |
|00000310| 74 68 69 73 20 74 79 70 | 65 20 6f 66 20 63 6f 64 |this typ|e of cod|
|00000320| 65 20 69 73 3a 0a 3e 20 | 0a 3e 20 3a 20 76 6f 69 |e is:.> |.> : voi|
|00000330| 64 20 70 72 6f 63 65 64 | 75 72 65 20 28 61 72 67 |d proced|ure (arg|
|00000340| 75 6d 65 6e 74 2e 2e 2e | 29 0a 3e 20 3a 20 20 20 |ument...|).> : |
|00000350| 20 7b 0a 3e 20 3a 20 20 | 20 20 73 74 61 74 69 63 | {.> : | static|
|00000360| 20 63 68 61 72 20 2a 20 | 62 75 66 66 65 72 20 3d | char * |buffer =|
|00000370| 20 30 3b 0a 3e 20 0a 3e | 20 3a 20 20 20 20 69 66 | 0;.> .>| : if|
|00000380| 20 28 62 75 66 66 65 72 | 20 3d 3d 20 30 29 0a 3e | (buffer| == 0).>|
|00000390| 20 3a 20 20 20 20 20 20 | 20 20 62 75 66 66 65 72 | : | buffer|
|000003a0| 20 3d 20 6d 61 6c 6c 6f | 63 20 28 32 30 34 38 29 | = mallo|c (2048)|
|000003b0| 3b 20 20 2f 2a 20 6f 72 | 20 61 6e 79 20 5f 6c 61 |; /* or| any _la|
|000003c0| 72 67 65 5f 20 6e 75 6d | 62 65 72 20 2a 2f 20 0a |rge_ num|ber */ .|
|000003d0| 3e 20 3a 20 20 20 20 2e | 2e 2e 0a 3e 20 3a 20 54 |> : .|...> : T|
|000003e0| 68 65 20 69 64 65 61 20 | 69 73 20 74 68 61 74 20 |he idea |is that |
|000003f0| 22 62 75 66 66 65 72 22 | 20 69 73 20 61 20 63 61 |"buffer"| is a ca|
|00000400| 70 74 69 76 65 20 6d 65 | 6d 6f 72 79 20 6c 65 61 |ptive me|mory lea|
|00000410| 6b 20 2d 2d 20 79 6f 75 | 20 61 6c 6c 6f 63 61 74 |k -- you| allocat|
|00000420| 65 20 61 0a 3e 20 3a 20 | 6c 61 72 67 65 20 62 75 |e a.> : |large bu|
|00000430| 66 66 65 72 20 6f 6e 63 | 65 20 61 6e 64 20 6e 65 |ffer onc|e and ne|
|00000440| 76 65 72 20 72 65 6c 65 | 61 73 65 20 69 74 2e 20 |ver rele|ase it. |
|00000450| 20 54 68 61 74 20 69 6e | 63 72 65 61 73 65 73 20 | That in|creases |
|00000460| 74 68 65 20 72 75 6e 74 | 69 6d 65 0a 3e 20 3a 20 |the runt|ime.> : |
|00000470| 73 69 7a 65 20 6f 66 20 | 79 6f 75 72 20 70 72 6f |size of |your pro|
|00000480| 67 72 61 6d 2c 20 62 75 | 74 20 65 6c 69 6d 69 6e |gram, bu|t elimin|
|00000490| 61 74 65 73 20 74 68 65 | 20 70 65 72 66 6f 72 6d |ates the| perform|
|000004a0| 61 6e 63 65 20 68 69 74 | 20 61 6e 64 20 70 6f 73 |ance hit| and pos|
|000004b0| 73 69 62 6c 65 0a 3e 20 | 3a 20 6d 65 6d 6f 72 79 |sible.> |: memory|
|000004c0| 20 6c 65 61 6b 73 20 66 | 72 6f 6d 20 72 65 70 65 | leaks f|rom repe|
|000004d0| 61 74 65 64 6c 79 20 61 | 6c 6c 6f 63 61 74 69 6e |atedly a|llocatin|
|000004e0| 67 20 61 6e 64 20 64 65 | 6c 65 74 69 6e 67 20 73 |g and de|leting s|
|000004f0| 6d 61 6c 6c 20 62 6c 6f | 63 6b 73 2e 0a 3e 20 0a |mall blo|cks..> .|
|00000500| 3e 20 48 6f 77 65 76 65 | 72 2c 20 69 74 20 6c 69 |> Howeve|r, it li|
|00000510| 6d 69 74 73 20 79 6f 75 | 20 74 6f 20 6e 6f 6e 2d |mits you| to non-|
|00000520| 6d 75 6c 74 69 74 68 72 | 65 61 64 65 64 20 70 72 |multithr|eaded pr|
|00000530| 6f 67 72 61 6d 73 2e 20 | 20 49 74 73 20 6c 69 74 |ograms. | Its lit|
|00000540| 74 6c 65 20 74 68 69 6e | 67 73 0a 3e 20 6c 69 6b |tle thin|gs.> lik|
|00000550| 65 20 74 68 69 73 20 74 | 68 61 74 20 6d 61 6b 65 |e this t|hat make|
|00000560| 20 74 72 79 69 6e 67 20 | 74 6f 20 75 73 65 20 65 | trying |to use e|
|00000570| 78 69 73 74 69 6e 67 20 | 63 6f 64 65 20 69 6e 20 |xisting |code in |
|00000580| 61 20 6d 75 6c 74 69 74 | 68 72 65 61 64 65 64 0a |a multit|hreaded.|
|00000590| 3e 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 72 65 |> enviro|nment re|
|000005a0| 61 6c 6c 79 20 68 61 72 | 64 20 73 6f 6d 65 74 69 |ally har|d someti|
|000005b0| 6d 65 73 20 3d 28 0a 0a | 57 65 6c 6c 2c 20 6c 69 |mes =(..|Well, li|
|000005c0| 66 65 20 69 73 20 61 20 | 73 65 72 69 65 73 20 6f |fe is a |series o|
|000005d0| 66 20 63 6f 6d 70 72 6f | 6d 69 73 65 73 2e 20 3a |f compro|mises. :|
|000005e0| 2d 29 20 20 49 20 75 73 | 65 20 74 68 69 73 20 74 |-) I us|e this t|
|000005f0| 65 63 68 6e 69 71 75 65 | 20 0a 62 65 63 61 75 73 |echnique| .becaus|
|00000600| 65 20 6f 66 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |e of the| number |
|00000610| 6f 66 20 74 69 6d 65 73 | 20 49 27 76 65 20 66 6f |of times| I've fo|
|00000620| 75 6e 64 20 62 75 67 73 | 20 28 69 6e 20 6f 74 68 |und bugs| (in oth|
|00000630| 65 72 73 20 70 65 6f 70 | 6c 65 73 0a 63 6f 64 65 |ers peop|les.code|
|00000640| 2c 20 6f 66 20 63 6f 75 | 72 73 65 20 3a 2d 29 20 |, of cou|rse :-) |
|00000650| 69 6e 20 73 6f 66 74 77 | 61 72 65 20 77 68 69 63 |in softw|are whic|
|00000660| 68 20 61 74 74 65 6d 70 | 74 65 64 20 74 6f 20 62 |h attemp|ted to b|
|00000670| 65 20 63 6c 65 76 65 72 | 20 61 62 6f 75 74 0a 6d |e clever| about.m|
|00000680| 65 6d 6f 72 79 20 61 6c | 6c 6f 63 61 74 69 6f 6e |emory al|location|
|00000690| 2e 20 20 49 6e 20 6e 6f | 6e 74 68 72 65 61 64 65 |. In no|nthreade|
|000006a0| 64 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 73 20 69 |d enviro|nments i|
|000006b0| 74 27 73 20 6f 66 74 65 | 6e 20 62 65 74 74 65 72 |t's ofte|n better|
|000006c0| 0a 74 6f 20 62 65 20 61 | 20 62 69 74 20 22 64 75 |.to be a| bit "du|
|000006d0| 6d 62 22 20 62 75 74 20 | 68 61 76 65 20 72 65 6c |mb" but |have rel|
|000006e0| 69 61 62 6c 65 20 63 6f | 64 65 20 74 68 61 6e 20 |iable co|de than |
|000006f0| 74 6f 20 62 65 20 22 63 | 6c 65 76 65 72 22 20 61 |to be "c|lever" a|
|00000700| 6e 64 0a 68 61 76 65 20 | 61 20 70 72 6f 62 6c 65 |nd.have |a proble|
|00000710| 6d 20 77 69 74 68 20 4a | 6f 65 20 73 63 72 65 77 |m with J|oe screw|
|00000720| 69 6e 67 20 75 70 20 79 | 6f 75 72 20 63 61 72 65 |ing up y|our care|
|00000730| 66 75 6c 6c 79 20 63 6f | 6e 73 74 72 75 63 74 65 |fully co|nstructe|
|00000740| 64 20 6c 6f 67 69 63 2e | 0a 0a 2d 2d 20 0a 42 65 |d logic.|..-- .Be|
|00000750| 61 72 20 47 69 6c 65 73 | 20 20 20 20 20 20 20 20 |ar Giles| |
|00000760| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 46 6f 72 | | For|
|00000770| 20 65 76 65 72 79 20 63 | 6f 6d 70 6c 65 78 20 70 | every c|omplex p|
|00000780| 72 6f 62 6c 65 6d 20 74 | 68 65 72 65 20 69 73 20 |roblem t|here is |
|00000790| 61 6e 0a 62 65 61 72 40 | 69 6e 64 72 61 2e 63 6f |an.bear@|indra.co|
|000007a0| 6d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |m | |
|000007b0| 20 20 61 6e 73 77 65 72 | 20 74 68 61 74 20 69 73 | answer| that is|
|000007c0| 20 63 6c 65 61 72 2c 20 | 73 69 6d 70 6c 65 20 61 | clear, |simple a|
|000007d0| 6e 64 20 77 72 6f 6e 67 | 2e 0a 20 20 20 20 20 20 |nd wrong|.. |
|000007e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000007f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000800| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000810| 20 2d 2d 20 48 20 4c 20 | 4d 65 6e 63 6b 65 6e 0a | -- H L |Mencken.|
+--------+-------------------------+-------------------------+--------+--------+